<?php
/**
 * 判断是否使用API访问
 */

if(isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
  header('Access-Control-Allow-Methods: GET, HEAD, POST, PUT, PATCH, DELETE');
  header('Access-Control-Allow-Headers: X-Requested-With, Content-Type');
  header('Access-Control-Allow-Credentials: true');

  header('Content-type: application/json;charset=utf-8');

  exit(json_encode(['code' => 0, 'msg'=>'Success']));
}

define('APPLICATION_ROOT_DIR', dirname(__DIR__));

define('APPLICATION_SRC_DIR', APPLICATION_ROOT_DIR . '/src');

define('APPLICATION_ENV', 'development');
//define('APPLICATION_ENV', 'production');

require APPLICATION_SRC_DIR . '/bootstrap_base.php';
